import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  //Home页面
  {
    path: '/',
    name: 'Home',
    meta: {
      auth: true
    },
    redirect: '/ddd',
    component: Home,
    children: [
      {
        //用户列表
        path: '/ddd',
        name: 'ddd',
        component: () => import('../views/Ddd.vue'),
      },
      {
        //用户列表
        path: '/userlist',
        name: 'userlist',
        component: () => import('../views/UserList.vue'),
      }, {
        //角色列表
        path: '/rolelist',
        name: 'rolelist',
        component: () => import('../views/RoleList.vue'),
      }, {
        //权限列表
        path: '/powerlist',
        name: 'powerlist',
        component: () => import('../views/PowerList.vue'),
      },{
        //商品列表
        path: '/goodslist',
        name: 'goodslist',
        component: () => import('../views/GoodsList.vue'),
      },{
        //商品添加
        path: '/goodsadd',
        name: 'goodsadd',
        component: () => import('../views/GoodsAdd.vue'),
      },{
        //分类参数
        path: '/parameter',
        name: 'parameter',
        component: () => import('../views/Parameter.vue'),
      },{
        //商品分类
        path: '/cate',
        name: 'cate',
        component: () => import('../views/Cate.vue'),
      },{
        //订单管理
        path: '/orderlist',
        name: 'orderlist',
        component: () => import('../views/OrderList.vue'),
      },{
        //数据管理
        path: '/record',
        name: 'record',
        component: () => import('../views/Record.vue'),
      }
    ]
  },
  //登录页
  {
    path: '/login',
    name: 'Login',
    component: () => import('../views/Login.vue')
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
